//
//  ViewController.m
//  DEMO
//
//  Created by J on 16/5/22.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"
#import "ACRouter.h"

#import "SecondViewController.h"

#import <objc/runtime.h>
@interface ViewController ()
@property (nonatomic, strong) NSMutableArray *valuesReceived;
@property (nonatomic, strong) SecondViewController* sc;

@end

@implementation ViewController

+ (void)load{
    [ACRouter  map:@"SecondViewController" toControllerClass:SecondViewController.class];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.valuesReceived = [NSMutableArray array];
    self.view.backgroundColor = [UIColor orangeColor];
    // Do any additional setup after loading the view, typically from a nib.
//    [self.valuesReceived addObject:@"xxx1" ?: nil];
//
//    NSString* a  = @"2";;
//    [self.valuesReceived addObject:a = a?: @"3"];
//
//    NSLog(@"%@",self.valuesReceived);
//    imp_implementationWithBlock(^(id self) {
//        
//        return self;
//    });
//
    
//    SecondViewController* new = [SecondViewController new];
//    self.sc = new;
//    [self addChildViewController:new];
////    [self.sc addObserver:self forKeyPath:@"dic" options:NSKeyValueObservingOptionNew context:nil];
//    
//    
//    NSMutableDictionary * d = [NSMutableDictionary dictionary];
//    self.sc.dic = d;
//    [self.sc.dic addObserver:self forKeyPath:@"foo" options:0 context:NULL];
//    
//    NSArray *arrayFilter = [NSArray arrayWithObjects:@"abc1", @"abc2", nil];
//    NSArray *arrayContent = [NSArray arrayWithObjects:@"a1", @"abc1", @"abc4", @"abc2", nil];
//    NSPredicate *thePredicate = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)", arrayFilter];
//    NSArray* arr =   [arrayContent filteredArrayUsingPredicate:thePredicate];



}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{
    NSLog(@"xxx%@",change);
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
//    [ACRouter push:@"SecondViewController" WithParameters:@{
//                                                            @"name" : @"名字",
//                                                            @"age" : @"15岁",
//                                                            @"home" : @"home",
//                                                            @"nick" : @"nick"
//                                                            
//                                                            }];
//    
    
    
    SecondViewController* sc = [SecondViewController new];
    [sc performSelector:NSSelectorFromString(@"xxxxx")];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
